home *** CD-ROM | disk | FTP | other *** search
- Path: scms.rgu.ac.uk!dracon!cs2lk
- From: cs2lk@scms.rgu.ac.uk (Lee Kindness)
- Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Subject: Re: How do I define my integers?
- Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Date: 17 Jan 1996 14:28:36 GMT
- Organization: The Robert Gordon University, School of Computer and Mathematical Sciences, Aberdeen, Scotland
- Message-ID: <4dj12k$pe1@roadkill.scms.rgu.ac.uk>
- References: <4d73ug$25v@vixen.cso.uiuc.edu>
- NNTP-Posting-Host: cs2lk%@dracon.scms.rgu.ac.uk
- X-Newsreader: TIN [version 1.2 PL2]
-
- howard daniel joseph (djhoward@ux5.cso.uiuc.edu) wrote:
- : Okay. I'm writing a program under GCC on my Amiga.
- : But I'm confused to hell over integer limits.
- : My book talks about 2 bit and 4 bit integers ... and four bit
- : integers like what it describers long integers to be. Of course there's
- : unsigned integers and the like too.
-
- I'll explain it normall C way first followed by the Amiga includes
- standard in brackets.
-
- : How do I declare signed versus unsigned integers?
-
- Signed by default, add "unsigned" to make unsigned, eg
-
- int i; // Signed integer
- signed int i2; // Signed integer
- unsigned int i3; // Unsigned integer
-
- : How do I know how many bits my integers are using?
-
- You can really do it explicitly, best to read the compiler documentation.
- However on the Amiga:
-
- short = 2
- long = 4
- (plain int = 2 or 4 depending on compiler, options)
-
- : How do I declare signed and unsigned long integers?
-
- long int i; // Long signed integer
- (LONG i; //Long signed integer)
- unsigned long int i1; // unsigned long integer
- (ULONG i1; // unsigned long int)
-
- : What's with these "doubles" the book mysteriously alludes to?
-
- Similar to float but greater precision.
-
- : What *am* I creating when I type;
-
- : int somevalue;
- : (ie Is it signed/unsigned? How many bits?)
-
- Normally signed, 4 bits on the Amiga.
-
- : An integer (unsigned) that can handle, 6, though ideally 9 places (Just
- : under 250000000 would be the maximum forseen possible value here.)
- : An integer that can handle a much bigger number ... 12 places at least for
- : now.
-
- Simply 2^32 is as much as you can bung into a "unsigned long int"
-
- : Can I perform simple maths (addition, division) between integers of
- : different types? I'd assume so, right?
-
- Yup.
-
- --
- \ Lee Kindness
- \ wangi@frost3.demon.co.uk
- \ cs2lk@scms.rgu.ac.uk
- \ Current Amiga projects - Tenodif, GMulti, NLFind, FindXXX, GFindXXX
- \=> Trumpet Blower!
-
-